package com.b2c.ftysys.dao;


public class DatabaseException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2009820170564369420L;

	private static class databaseMessage {
		private String message;

		databaseMessage(String m) {
			message = m;
		}

		public String getMessage() {
			return message;
		}
	}

	public static final databaseMessage SAVE_FAIL = new databaseMessage(
			"save fail! ");

	public static final databaseMessage SAVE_FAIL_CAUSE_ID_EXIST = new databaseMessage(
			"save fail! because PKID already exist!");

	public static final databaseMessage UPDATE_FAIL_CAUSE_ID_EXIST = new databaseMessage(
			"update fail!because PartNO already exist!");

	public static final databaseMessage DELETE_FAIL = new databaseMessage(
			"delete fail!");

	public static final databaseMessage SELECT_ALL_FAIL = new databaseMessage(
			"select all fail!");

	public static final databaseMessage SELECT_BY_ID_FAIL = new databaseMessage(
			"select by id fail!");

	public static final databaseMessage SELECT_BY_LIKE_PROPERTY_FAIL = new databaseMessage(
			"select by like property fail!");

	public static final databaseMessage SELECT_BY_PROPERTY_FAIL = new databaseMessage(
			"select by property fail!");

	public static final databaseMessage UPDATE_FAIL = new databaseMessage(
			"update fail!");

	public DatabaseException(databaseMessage m) {
		super(m.message);
	}

	public DatabaseException(databaseMessage m, int codeNum) {
		super(codeNum + ":" + m.message);
	}

	public DatabaseException(databaseMessage m, String val) {
		super(m.message + "," + val);
	}

	public DatabaseException(databaseMessage m, Throwable cause) {
		super(m.message, cause);
	}

	public DatabaseException(Throwable cause) {
		super(cause);
	}
	
	public DatabaseException(String msg, Throwable cause) {
		super(msg,cause);
	}

	public DatabaseException(String string) {
		super(string);
	}

}
